<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <title>Quản lý hệ thống</title>
    </h:head>
    <h:body>
        <link type="text/css" rel="stylesheet" href="../css/main.css" />
        <style type="text/css">                
            .ui-corner-all{
                border-radius: 0px !important
            }
            .ui-tree.ui-widget.ui-widget-content.ui-corner-all{
                border: solid 0px !important;
            }
        </style>
        <style type="text/css">
            .ui-panelgrid td {
                border-color:inherit;
                border-style:solid;
                border-width:0px;
                padding:6px 7.5px;
            }
        </style>
        <style type="text/css">
            td {
                vertical-align: top !important;
            }
            .pnct td{
                vertical-align: middle !important;
            }
        </style>
        <style type="text/css">
            .ui-panel {
                padding:0;
            }
        </style>
        <style type="text/css">
            .ui-widget{font-size:95% !important;}
            .ui-layout-unit-content{background-color: #E5E5E5;border-width: 0px}        
            .ui-widget{border-width: 0px;color: red}
        </style>        
        <div align="center" id="bodyForm" >            
            <div style="width: 100%;">
                <p:layoutUnit id="top" position="north" size="auto">
                    <ui:insert name="menu">
                        <ui:include src="../../templates/menu.xhtml"/>
                    </ui:insert>
                </p:layoutUnit>
                <p:layoutUnit id="center" position="center" size="400">
                    <h1 class="headerbar">Quản lý hệ thống</h1>
                    <h:form id="form">
                        <p:growl id="message"/>
                        <div style="margin: 0px 0px 10px 0px;">
                            <p:panel style=" width: 100%;" id="pnlInput">  
                                <f:facet name="header">  
                                    Danh mục sự kiện
                                </f:facet> 
                                <p:panelGrid columns="6"  style=" width: 100%;">
                                    <h:outputText value="#{PP_FORMSYSTEM.code}" style="color:red;"></h:outputText>
                                    <p:inputText disabled="#{system.isbFieldEnable()}"
                                                 value="#{system.ETTFormSystem.SYS_CODE}"></p:inputText>
                                    <h:outputLabel value="#{PP_FORMSYSTEM.name}" style="color:red;"/>
                                    <p:inputText disabled="#{system.isbFieldEnable()}" 
                                                 value="#{system.ETTFormSystem.SYS_NAME}"></p:inputText>
                                    <h:outputText value="#{PP_FORMSYSTEM.status}" style="color:red;"></h:outputText>
                                    <p:selectOneMenu disabled="#{system.isbFieldEnable()}" 
                                                     value="#{system.ETTFormSystem.STATUS}" >
                                        <f:selectItem itemValue="0" itemLabel="#{PP_FORMSYSTEM.khl}"/>
                                        <f:selectItem itemValue="1" itemLabel="#{PP_FORMSYSTEM.hl}"/>
                                    </p:selectOneMenu>
                                </p:panelGrid>
                                <p:panelGrid columns="4" style=" width: 100%;">
                                    <h:outputText value="#{PP_FORMSYSTEM.char_mode}" ></h:outputText>
                                    <p:selectManyCheckbox 
                                        disabled="#{system.isbFieldEnable()}" 
                                        value="#{system.ETTFormSystem.CHAR_MODE}" > 
                                        <f:selectItem itemValue="1" itemLabel="#{PP_FORMSYSTEM.auto}"/>
                                        <f:selectItem itemValue="2" itemLabel="#{PP_FORMSYSTEM.manual}"/>
                                    </p:selectManyCheckbox>
                                    <h:outputText value="#{PP_FORMSYSTEM.content_mode}"></h:outputText>
                                    <p:selectManyCheckbox disabled="#{system.isbFieldEnable()}" 
                                                          value="#{system.ETTFormSystem.CONTENT_MODE}" > 
                                        <f:selectItem itemValue="1" itemLabel="#{PP_FORMSYSTEM.get}"/>
                                        <f:selectItem itemValue="2" itemLabel="#{PP_FORMSYSTEM.push}"/>
                                        <f:selectItem itemValue="3" itemLabel="#{PP_FORMSYSTEM.sms}"/>
                                    </p:selectManyCheckbox>
                                </p:panelGrid>
                                <f:facet name="footer">
                                    <div align="center">
                                        <p:commandButton  value="#{PP_FORMSYSTEM.add}" icon="ui-icon-plusthick" style="margin:1px 1px 1px 110px;width: 110px;"
                                                          rendered="#{system.isbRendered()}"
                                                          disabled="#{system.isbDisableAddSearch()}"
                                                          actionListener="#{system.changeState(2, true)}"
                                                          update=":form:pnlInput" oncomplete="block.show()"/>
                                        <p:commandButton  value="#{PP_FORMSYSTEM.addcopy}" icon="ui-icon-copy" style="margin:1px;width: 110px;"
                                                          rendered="#{system.isbRendered()}"
                                                          disabled="#{!system.isbDisableModifyRemove()}"
                                                          actionListener="#{system.changeState(8, true)}"
                                                          update=":form:pnlInput" oncomplete="block.show()"/>
                                        <p:commandButton  value="#{PP_FORMSYSTEM.modify}" icon="ui-icon-wrench" style="margin:1px;width: 110px;"
                                                          rendered="#{system.isbRendered()}"
                                                          disabled="#{!system.isbDisableModifyRemove()}"
                                                          actionListener="#{system.changeState(3, true)}"
                                                          update=":form:pnlInput" oncomplete="block.show()"/>
                                        <p:commandButton  value="#{PP_FORMSYSTEM.remove}" icon="ui-icon-trash" style="margin:1px;width: 110px;"
                                                          rendered="#{system.isbRendered()}"
                                                          disabled="#{!system.isbDisableModifyRemove()}"
                                                          onclick="confirmation.show()"
                                                          />
                                        <p:commandButton  value="#{PP_FORMSYSTEM.ok}" icon="ui-icon-disk" style="margin:1px 1px 1px 200px;width: 110px;"
                                                          rendered="#{system.isbSave()}" 
                                                          actionListener="#{system.changeState(6, false)}"
                                                          update=":form:pnlInput :form:tblSys :form:message" oncomplete="block.hide()"/>
                                        <p:commandButton  value="#{PP_FORMSYSTEM.cancle}" icon="ui-icon-cancel" style="margin:1px;width: 110px;"
                                                          rendered="#{system.isbCancel()}" 
                                                          actionListener="#{system.changeState(7, false)}"
                                                          update=":form:pnlInput" oncomplete="block.hide()"/>
                                        </div>
                                    </f:facet>  
                                </p:panel>
                            </div> 
                            <p:panel id="pnlData" header="#{PP_FORMSYSTEM.table_name}">
                                <p:dataTable id="tblSys" 
                                             var="dataSys" 
                                             value="#{system.listData}"
                                             paginator="true" rows="10" 
                                             paginatorPosition ="bottom"
                                             rowsPerPageTemplate="5,10,15"  
                                             rowKey="#{dataSys.SYS_ID}" 
                                             selection="#{system.selectedRow}" 
                                             selectionMode="single"
                                             >
                                    <p:ajax event="rowSelect" listener="#{system.onRowSelect()}"   
                                            update=":form:pnlInput" />
                                    <p:ajax event="rowDblselect" listener="#{system.changeState(3, true)}"   
                                            update=":form:pnlInput" />

                                    <p:column sortBy="#{dataSys.SYS_CODE}">
                                        <f:facet name="header">
                                            <h:outputText value="#{PP_FORMSYSTEM.code}" />
                                        </f:facet>
                                        <h:outputText value="#{dataSys.SYS_CODE}"/>
                                    </p:column>
                                    <p:column sortBy="#{dataSys.SYS_NAME}">
                                        <f:facet name="header">
                                            <h:outputText value="#{PP_FORMSYSTEM.name}" />
                                        </f:facet>
                                        <h:outputText value="#{dataSys.SYS_NAME}" />
                                    </p:column>
                                    <p:column sortBy="#{dataSys.STATUS}">
                                        <f:facet name="header">
                                            <h:outputText value="#{PP_FORMSYSTEM.status}" />
                                        </f:facet>
                                        <h:outputText value="#{dataSys.STATUS eq 1 ? PP_FORMSYSTEM.enable:PP_FORMSYSTEM.disable}" style="float: right;"/>
                                    </p:column>
                                </p:dataTable>
                            </p:panel>
                            <!-- Enable/Disable data table -->
                            <p:blockUI id="block" block="pnlData" widgetVar="block"/>
                            <p:confirmDialog id="confirmDialog"
                                             message="#{PP_FORMSYSTEM.confirm}"
                                             header="#{PP_FORMSYSTEM.cf_header}" severity="alert"
                                             widgetVar="confirmation">
                                <p:commandButton id="confirm" value="#{PP_FORMSYSTEM.sure}"
                                                 oncomplete="confirmation.hide()" actionListener="#{system.changeState(4, false)}" update=":form :form:message"
                                                 />
                                <p:commandButton id="decline" value="#{PP_FORMSYSTEM.nyet}"
                                                 onclick="confirmation.hide()" type="button" /> 
                                </p:confirmDialog>
                            </h:form>        
                        </p:layoutUnit>
                        <p:layoutUnit id="bottom" position="bottom" size="60">
                            <ui:insert name="footer">
                                <ui:include src="../../templates/footer.xhtml"/>
                            </ui:insert>
                        </p:layoutUnit>
                    </div>
                </div>
            </h:body>
        </html>

